<section>
  <header class="title">
    <div>管理员设置</div>
    <div *ngIf="user$ | async as admin_user">
      <button
        class="btn btn-sm btn-outline-dark"
        *ngIf="admin_user.auth_nodes?.includes(AutoNodeConst.CreateAdminUser)"
        routerLink="add"
      >
        添加
      </button>
    </div>
  </header>
  <main>
    <m-tree [data]="data$ | async">
      <ng-template let-admin_user>
        <div class="line">
          <div class="name">
            <a [mDetailRouterLink]="{ id: admin_user.id, name: admin_user.full_name, type: 'admin' }">
              {{ admin_user.full_name }}
            </a>
          </div>
          <div>{{ admin_user.remark }}</div>
          <div class="count">
            <span>管理区域数：{{ admin_user.area_count }}</span>
            <span>管理人数：{{ admin_user.user_count }}</span>
            <span>管理终端数：{{ admin_user.pc_count }}</span>
            <span>管理软件数：{{ admin_user.software_count }}</span>
            <span *ngIf="admin_user.last_login_time === '0001-01-01T00:00:00Z' else elseBlock">最后登录时间：暂无</span>
            <ng-template #elseBlock>
              <span>最后登录时间：{{ admin_user.last_login_time | date }}</span>
            </ng-template> 
          </div>
        </div>
      </ng-template>
    </m-tree>
  </main>
</section>
